// import Vue from 'vue'
import server from '@/utils/request'
import store from './store/'
import { Notify } from 'vant'
// request 拦截器
server.interceptors.request.use(function(config) {
  if (store.getters.token) {
    config.headers['Authorization'] = 'Bearer ' + store.getters.token // 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
  }
  return config
}, function(error) {
  return Promise.reject(error)
})

// response 拦截器
server.interceptors.response.use(function (response) {
  return response
}, function (error) {
  Notify({ type: 'warning', message: error.repsonse.data })
  return Promise.reject(error)
})
